<!--
	此示例下载自 https://echarts.apache.org/examples/zh/editor.html?c=treemap-disk
-->
<!DOCTYPE html>
<html lang="en" style="height: 100%">

<head>
    <meta charset="utf-8">
</head>

<body style="height: 100%; margin: 0">
    <div id="container" style="height: 100%"></div>
    <script type="text/javascript" src="echarts.min.js"></script>
    <script type="text/javascript" src="base.js"></script>
    <script type="text/javascript">
        var dom = document.getElementById('container');
        var myChart = echarts.init(dom, null, {
            renderer: 'canvas',
            useDirtyRect: false
        });
        var app = {};
        var option = {};

        function setData(optionPy) {
            const func = new Function(optionPy.series);

            option = optionPy;
            drawChart();
        }

        function drawChart() {
            myChart.setOption(option);
        }

        function getLevelOption() {
            return [
                {
                    itemStyle: {
                        borderWidth: 0,
                        gapWidth: 5
                    }
                },
                {
                    itemStyle: {
                        gapWidth: 1
                    }
                },
                {
                    colorSaturation: [0.35, 0.5],
                    itemStyle: {
                        gapWidth: 1,
                        borderColorSaturation: 0.6
                    }
                }
            ];
        }

        function getFormatter(info) {
            var value = info.value;
            var treePathInfo = info.treePathInfo;
            var treePath = [];
            for (var i = 1; i < treePathInfo.length; i++) {
                treePath.push(treePathInfo[i].name);
            }
            return [
                '<div class="tooltip-title">' +
                formatUtil.encodeHTML(treePath.join('/')) +
                '</div>',
                'Disk Usage: ' + formatUtil.addCommas(value) + ' KB'
            ].join('');
        }

        window.addEventListener('resize', myChart.resize);
    </script>
</body>

</html>